package com.leetcode.week.week293;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * @author angzhijin
 * @Description
 * @create 2022-05-15 11:00 上午
 */
public class Week3 {
    public static void main(String[] args) {
        largestCombination(new int[]{16,17,71,62,12,24,14});
        largestCombination(new int[]{16,17,71,62,24,14});
    }

    public static int largestCombination(int[] candidates) {
        int n = candidates.length;
//        int tmp = Integer.MAX_VALUE;
//        for (int item : candidates) {
//            tmp &= item;
//        }
//        System.out.println(tmp);
        
        int[] binary = new int[64];
        for (int item : candidates) {
            for (int i = 0; i < 64; i++) {
                if((item & (1<<i)) == (1<<i)){
                    binary[i]+=1;
                }
            }
        }
        System.out.println(Arrays.toString(binary));
        int max = 0;
        for (int i = 0; i < 64; i++) {
            max = Math.max(max ,binary[i]);
        }
        System.out.println(max);
        return max;
    }
}
